/*
 * Copyright (c) 2006, 2021, webrx.cn All rights reserved.
 *
 */
package cn.webrx;

import java.util.concurrent.TimeUnit;

/**
 * <p>Project: javase - T17
 * <p>Powered by webrx On 2021-12-27 14:15:01
 * <p>Created by IntelliJ IDEA
 *
 * @author webrx [webrx@126.com]
 * @version 1.0
 * @since 17
 */
public class T17 {
    synchronized void m1() {
        var tn = Thread.currentThread().getName();
        System.out.println(tn);
        m2();
        try {
            TimeUnit.SECONDS.sleep(10);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    synchronized void m2() {
        var tn = Thread.currentThread().getName();
        System.out.println(tn);
    }


    public static void main(String[] args) {
        var t = new T17();

        new Thread(t::m1, "T1").start();

        new Thread(t::m2, "T2").start();

    }
}
